/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package apteka.admin;

import java.util.Map;
import javax.servlet.http.HttpSession;
import org.springframework.context.annotation.Scope;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;

/**
 *
 * @author Marek
 */
@Controller
@RequestMapping("/admin_panel/main.htm")

public class AdminMainController {

    @Secured("ROLE_ADMIN")
    @RequestMapping(method = RequestMethod.GET)
     public String showPage(Map model, HttpSession session) {
        model.put("page", "welcome.jsp");
        return "admin_panel/main";
     }

    @Secured("ROLE_ADMIN")
    @RequestMapping(params="op=logout")
    public String logout(Map model, HttpSession session) {
        session.invalidate();
        return "redirect:index.htm";
    }

}
